package jax;

/**
 * ...
 * @author tom
 */
class JProperties {
	public static function read(data:String):Hash<String> {
		var hash = new Hash<String>();
		var lines = data.split("\n");
		for(l in lines) {
			var li = l.split(":");
			if(li.length == 2)
			hash.set(StringTools.trim(li[0]), StringTools.trim(li[1]));
		}
		return hash;
	}
	public static function write(data:Hash<String>):String {
		var s = "";
		for(k in data.keys()) {
			s += k+": "+data.get(k)+"\n";
		}
		return s;
	}
}
